<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>会员列表</title>
	<script type='text/javascript' src='__ROOT__/Data/Org/Jquery/jquery-1.8.2.min.js'></script>
	<link href='__ROOT__/Data/Org/hdjs/css/hdjs.css' rel='stylesheet' media='screen'>
	<script type='text/javascript' src='__ROOT__/Data/Org/hdjs/js/hdjs.js'></script>
	<script type='text/javascript' src='__ROOT__/Data/Org/hdjs/js/slide.js'></script>
	<script type='text/javascript' src='__ROOT__/Data/Org/hdjs/org/cal/lhgcalendar.min.js'></script>
	<script type='text/javascript'>
		ACTION='__URL__'; //当前模块(控制器)
		ROOT='__ROOT__'; //当前项目根路径
		PUBLIC= '__PUBLIC__';//当前定义的Public目录
	</script>
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/Css/mod.base.css" />
	<style type="text/css">
		.search{
			border: 1px solid #FFBE7A;
			background: none repeat scroll 0 0 #FFFCED;
			line-height: 20px;
			padding: 8px 10px;
		}
		.red{
			color:red;
		}
	</style>

	<link rel="stylesheet" type="text/css" href="__PUBLIC__/Css/mod.base.css" />
</head>
<body>

	
	<div class="wrap">

		<form action="<?php echo U('User/index');?>" class="hd-form" method="get">
			<input type="hidden" name="cid" value="<?php echo ($_GET['cid']); ?>" />
			<input type="hidden" name="sta" value="<?php echo ($_GET['sta']); ?>" />
			<div class="search">
				注册时间：
				<input id="begin_time" placeholder="开始时间" readonly="readonly" class="w80" type="text" value="<?php if(isset($_GET["search_begin_time"])): echo ($_GET['search_begin_time']); endif; ?>" name="search_begin_time">
				<script>
					$('#begin_time').calendar({
						format : 'yyyy-MM-dd'
					});
				</script>
				<input id="end_time" placeholder="结束时间" readonly="readonly" class="w80" type="text" value="<?php if(isset($_GET["search_end_time"])): echo ($_GET['search_end_time']); endif; ?>" name="search_end_time">
				<script>
					$('#end_time').calendar({
						format : 'yyyy-MM-dd'
					});
				</script>
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				关键字：
				<input class="w200" type="text" placeholder="请输入关键字..." value="<?php if(isset($_GET["search_keyword"])): echo ($_GET['search_keyword']); endif; ?>" name="search_keyword">
				<button class="hd-cancel" type="submit">
					搜索
				</button>
			</div>
		</form>

		<form action="<?php echo U('User/update');?>" method="post" id='list'>
			<div class="menu_list">
				<ul>
					<li>
						<a class='action' href="<?php echo U('User/index');?>" >
							会员列表
						</a>
					</li>
					
					<li>
						<a href="<?php echo U('User/add');?>">
							添加会员
						</a>
					</li>
					
				</ul>
			</div>
			<table class=" hd-form table2">
				
					<tr>
						<td class="w30">
						<input type="checkbox" class="select_all"/>
						</td>
						<td class="w30">UID</td>
						<td >用户名</td>
						<td class="w100">邮箱</td>
						<td class="w100">注册时间</td>
						<td class="w100">登录次数</td>
						<td class="w100">登录时间</td>
						<td class="w100">登录IP</td>
						<td class="w100">状态</td>
						<td class="w100">操作</td>
					</tr>
				
				<?php if($data): if(is_array($data)): foreach($data as $key=>$v): ?><tr>
					<td><input type="checkbox" name="uid[<?php echo ($v["uid"]); ?>]" value="<?php echo ($v["uid"]); ?>"/></td>
					<td><?php echo ($v["uid"]); ?></td>
					<td>
					<?php echo ($v["username"]); ?>
					</td>
					<td><?php echo ($v["email"]); ?></td>
					<td><?php echo ($v["reg_time"]); ?></td>
					<td><?php echo ($v["times"]); ?></td>
					<td><?php echo ($v["login_ip"]); ?></td>
					<td><?php echo ($v["login_time"]); ?></td>
					<td><?php echo ($v["lock"]); ?></td>
					<td>
						<a href="<?php echo U('User/edit',array('uid'=>$v['uid']));?>">
							修改
						</a>
						<span class="line">|</span>
						<a href="javascript:var del='<?php echo U('User/del',array('uid'=>$v['uid']));?>';hd_confirm('确认删除吗？',function(){location.href=del})">
							删除
						</a>
					</td>
				</tr><?php endforeach; endif; ?>
				<tr><td colspan="10" class="page"><?php echo ($page); ?></td></tr>
				<?php else: ?>
				<tr><td colspan="10">没有找到符合的记录</td></tr><?php endif; ?>
					
				</table>
			<div class="h60"></div>
			<input type="hidden" name='cid' value="<?php echo ($_GET['cid']); ?>"/>
		</form>
	</div>
	<div class="position-bottom">
		<input type="hidden" name='cid' value="<?php echo ($_GET['cid']); ?>" />
		<input type="button" class="hd-cancel" onclick="select_all(1)" value='全选'/>
		<input type="button" class="hd-cancel" onclick="select_all(0)" value='反选'/>
		<input class="hd-cancel" type="button" value="锁定" onclick="update(2)" >
		<input class="hd-cancel" type="button" value="取消锁定" onclick="update(3)" >
		<input class="hd-cancel" type="button" value="删除" onclick="update(4)" >
	</div>
<script>
//更新
function update(type) {
    //栏目检测
    var html;
    switch(parseInt(type))
	{
		case 1:
		type='排序';
		html='<input type="hidden" name="order" />';
		break;
		case 2:type='审核';
		html='<input type="hidden" name="lock" />';
		break;
		case 3:type='取消审核';
		html='<input type="hidden" name="cancel_lock" />';
		break;
		case 4:type='删除';
		html='<input type="hidden" name="del_check" />';
		break;
	}
    if ($("input[type='checkbox']:checked").length == 0) 
    {
        alert('没有信息用于'+type);
        return false;
    }
    $('#list').append(html);
  	$('#list').submit();
}
//点击input表单实现 全选或反选
$(function () {
    //全选
    $("input.select_all").click(function () {
        $("[type='checkbox']").attr("checked",$(this).attr('checked')=='checked');
    })
})
//全选复选框
function select_all(state){
	if(state==1){
		$("[type='checkbox']").attr("checked",state);
	}else{
		$("[type='checkbox']").attr("checked",function(){return !$(this).attr('checked')});
	}
}

</script>

</body>
</html>